package com.whfc.fse.enums;

/**
 * @author qzexing
 * @version 1.0
 * @date 2021/11/9 14:38
 */
public enum FsePart {

    CRANE_COCKPIT(1, 1, "塔机-驾驶舱"),

    CRANE_ARM(1, 2, "塔机-起重臂"),

    CRANE_LUFFING(1, 3, "塔机-变幅小车"),

    CRANE_BALANCE_ARM(1, 4, "塔机-平衡臂"),

    LIFT_LEFT(2, 1, "左"),

    LIFT_RIGHT(2, 2, "右"),

    CRAWLER_ARM(5, 1, "履带吊-大臂"),

    CRAWLER_FRONT_VIEW(5, 2, "履带吊-前视"),

    CRAWLER_REARVIEW(5, 3, "履带吊-后视"),

    CRAWLER_ROLLING(5, 4, "履带吊-卷场");

    private final Integer type;

    private final Integer value;

    private final String desc;


    FsePart(Integer type, Integer value, String desc) {
        this.type = type;
        this.value = value;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static FsePart parseValue(FseType fseType, Integer value) {
        if (fseType == null || value == null) {
            return null;
        }
        FsePart[] fseParts = FsePart.values();
        for (FsePart fsePart : fseParts) {
            if (fsePart.getType().equals(fseType.getValue()) && value.equals(fsePart.getValue())) {
                return fsePart;
            }
        }
        return null;
    }

}
